﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GurLoader.Preferences
{
    public interface IFileOperations
    {
        /// <summary>
        /// Given a path returns the directory portion of the path.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        string GetDirectoryName(string fileName);

        /// <summary>
        /// Checks whether or not a directory currently exists.
        /// </summary>
        /// <param name="directory"></param>
        /// <returns></returns>
        bool DirectoryExists(string directory);

        /// <summary>
        /// Creates a directory. 
        /// </summary>
        /// <param name="directory"></param>
        void CreateDirectory(string directory);

        /// <summary>
        /// Writes all data to the given filename as text.
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="data"></param>
        void WriteAllText(string fileName, string data);

        /// <summary>
        /// Checks whether or not a file exists.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        bool FileExists(string fileName);

        /// <summary>
        /// Reads all contents of a file at the given path.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        string ReadAllText(string fileName);

        /// <summary>
        /// Returns a temp filename.
        /// </summary>
        /// <returns></returns>
        string GetTempFileName();

        /// <summary>
        /// Deletes the file at the given path.
        /// </summary>
        /// <param name="filename"></param>
        void DeleteFile(string filename);
    }
}
